#include <iostream>
using namespace std;

class Solution {
public:
	bool isPalindrome(int x) {
		if(x==0)
			return true;
		if(x<0||x%10==0)
			return false;
		
		int y=0;
		while(y<x)
		{
			y=y*10+x%10;
			x=x/10;
		}
		if(x==y)
			return true;
		else
		{
			x=x*10+y%10;
			return x==y;
		}
	}
};

int main(){
	Solution solution;
	int x;
	while(cin>>x){
		cout<<solution.isPalindrome(x)<<endl;
	}
}